<template>
  <div>
    <Top title="设置" iconShow="1"></Top>
    <div class="setting">
      <div class="setting-setpassword" @click="goSetpassword">
        <span>登录密码设置</span>
        <i class="iconfont icon-jiankuohaoxiyou"></i>
      </div>
      <!-- <div class="setting-fintpassword" @click="goForgetpassword">
          <span>找回密码</span>
          <i class="iconfont icon-jiankuohaoxiyou"></i>
        </div> -->
    </div>
    <div class="out-login" @click="outLogin">退出登录</div>
  </div>
</template>
<script>
import Top from '../components/Header'
import $cookie from 'vue-cookie'
import {Indicator} from 'mint-ui'
import {MessageBox} from 'mint-ui'
export default {
  name: 'login',
  data() {
    return {

    }
  },
  methods: {
    goSetpassword() {
      // 进入设置密码页面
      this.$http.post("/loansupermarket-app/ login/isSetPwd")
        .then((response) => {
          var resBody = response.body;
          // console.log(resBody)
          if (resBody.code == '000') {
            if (resBody.result.isSetPwd) {
              this.$router.push({ path: '/modifypassword' })
            } else {
              this.$router.push({ path: '/setpassword' })
            }
          }
        })
    },
    outLogin() {
      // 退出登录
      this.$http.post('/loansupermarket-app/login/loginOut')
        .then((response) => {
          var resBody = response.body;
          var that = this;
          Indicator.open('加载中...')
          setTimeout(function(){
            Indicator.close();
            if(resBody.code=='000'){
               that.$router.push({path:'/login'})    
            }else{
              MessageBox.alert(resBody.msg,提示);
            }
          },500)
        })
    }
  },
  components: { Top }
}
</script>
<style lang="scss">
@import '../scss/variable/base.scss';
.setting {
  margin-top: 1.6rem;
  width: 95%;
  margin-left: 2.5%;
  &-setpassword,
  &-fintpassword {
    margin-top: 0.4rem;
    box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.05);
    width: 100%;
    height: 1.33rem;
    background: #fff;
    line-height: 1.33rem;
    font-size: 0.36rem;
    box-sizing: border-box;
    padding: 0 0.42rem;
    border-radius: 4px;
    &:active {
      background: $activeColor;
    }
    span {
      float: left;
    }
    i {
      float: right;
    }
  }
}

.out-login {
  width: 100%;
  height: 1.2rem;
  color: $primaryColor;
  position: absolute;
  bottom: 0;
  background: #fff;
  font-size: 0.42rem;
  line-height: 1.2rem;
  &:active {
    background: $activeColor;
  }
}
</style>
